import React from "react";
import {Input, Form, Button, Card, Row, Col} from 'antd'
import * as antd from "antd";
import {getTxn} from "../../api/api";

const Modal = antd.Modal;

class GetTxdInfo extends React.Component {
    constructor(props) {
        super(props);
        this.state = ({
            orderingId: 0,
            txnId: 0,
            visible: false
        })
    }
    showModal =async ()=> {
        // const data = await getTxn(this.state.orderingId);
        this.setState({
            visible: true
        });
    }

    onChange = (event) => {
        this.setState({
            orderingId: event.target.value
        })
    }


    handleOk =()=> {
        this.setState({
            confirmLoading: false,
            visible: false
        });
    }
    handleCancel =()=> {
        this.setState({
            visible: false
        });
    }

    render() {
        return (
            <Row>
                <Col span={8} offset={7}>
            <Card style={{textAlign:"center"}}>
                <Form.Item
                    label="OrderingId"
                    name="OrderingId"
                >
                    <Input style={{ width: 300 }} onChange={this.onChange} />
                </Form.Item>
                <Button type="primary" htmlType="submit" onClick={this.showModal}>
                    Submit
                </Button>
                <Modal visible={this.state.visible}  onOk={this.handleOk} onCancel={this.handleCancel}>
                    <p>Your TEX Number is:</p>
                    <p>a1bf0c4f8f8c854b67c6c70d1b22485bc1064bc5cf9e8c92a6823562e14dbab1</p>
                </Modal>

            </Card>
                </Col>
            </Row>
        )
    }
}


export default GetTxdInfo;